﻿<Window x:Class="Save_the_Humans__recode_.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Save the Humans" Height="700" Width="1000" Background="Black" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <ControlTemplate x:Key="AlienTemplate" TargetType="{x:Type ContentControl}">
            <Grid>
                <Ellipse Fill="Gray" Height="100" Stroke="Black" Width="80"/>
                <Ellipse Fill="Black" Height="35" Width="25" RenderTransformOrigin="0.5,0.5" Margin="20,20,50,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                    <Ellipse.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform AngleX="10"/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Ellipse.RenderTransform>
                </Ellipse>
                <Ellipse Fill="Black" Height="35" Width="25" RenderTransformOrigin="0.5,0.5" Margin="50,20,20,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                    <Ellipse.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform AngleX="-10"/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Ellipse.RenderTransform>
                </Ellipse>
            </Grid>
        </ControlTemplate>
        <ControlTemplate x:Key="hornAlienTemplate" TargetType="{x:Type ContentControl}">
            <Grid>
                <Rectangle Fill="Gold" HorizontalAlignment="Left" Height="30" VerticalAlignment="Top" Width="10" RenderTransformOrigin="0.5,0.5" Margin="10,0,0,0">
                    <Rectangle.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform AngleX="30"/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Rectangle.RenderTransform>
                </Rectangle>
                <Rectangle Fill="Gold" HorizontalAlignment="Right" Height="30" VerticalAlignment="Top" Width="10" RenderTransformOrigin="0.5,0.5" Margin="0,0,10,0">
                    <Rectangle.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform AngleX="-30"/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Rectangle.RenderTransform>
                </Rectangle>
                <Ellipse Fill="Gray" Height="100" Stroke="Black" Width="80"/>
                <Ellipse Fill="Red" Height="35" Width="25" RenderTransformOrigin="0.5,0.5" Margin="20,20,50,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                    <Ellipse.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform AngleX="10"/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Ellipse.RenderTransform>
                </Ellipse>
                <Ellipse Fill="Red" Height="35" Width="25" RenderTransformOrigin="0.5,0.5" Margin="50,20,20,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                    <Ellipse.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform AngleX="-10"/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Ellipse.RenderTransform>
                </Ellipse>


            </Grid>
        </ControlTemplate>
        <ControlTemplate x:Key="humanTemplate" TargetType="{x:Type ContentControl}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="3*"/>
                </Grid.RowDefinitions>
                <Ellipse 
                    Height="10" Width="10"
                    Fill="Yellow" Stroke="Black"/>
                <Rectangle
                    Grid.Row="1"
                    Height="30" Width="10"
                    Fill="Yellow" Stroke="Black"/>
            </Grid>
        </ControlTemplate>
    </Window.Resources>
    <Grid x:Name="grid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="140"/>
            <ColumnDefinition/>
            <ColumnDefinition Width="200"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="150"/>
        </Grid.RowDefinitions>
        <Button x:Name="start_btn" Content="Start!" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" FontFamily="Showcard Gothic" FontSize="20" Click="start_btn_Click"/>
        <ProgressBar x:Name="progressBar" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Height="30"/>
        <TextBlock x:Name="score" Grid.Column="1" TextWrapping="Wrap" Foreground="GreenYellow"
                   HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Margin="0,100,0,0"
                   Text="Score : 00" FontFamily="Courier New" FontSize="20"/>

        <Canvas x:Name="playArea" Grid.ColumnSpan="3" MouseLeave="playArea_MouseLeave" MouseMove="playArea_MouseMove">
            <Canvas.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="BlueViolet" Offset="0"/>
                    <GradientStop Color="Green" Offset="1"/>
                </LinearGradientBrush>
            </Canvas.Background>
            <Rectangle x:Name="target"
                       Canvas.Left="700" Canvas.Top="145" RenderTransformOrigin="0.5,0.5"
                       Height="50" Width="60" Stroke="Black"
                       MouseEnter="target_MouseEnter">
                <Rectangle.Fill>
                    <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                        <GradientStop Color="Chocolate" Offset="0.012"/>
                        <GradientStop Color="#FFFFDC00" Offset="1"/>
                    </LinearGradientBrush>
                </Rectangle.Fill>
                <Rectangle.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform Angle="45"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Rectangle.RenderTransform>
            </Rectangle>
            <TextBlock x:Name="resultText" TextWrapping="Wrap" Text="Save the Humans"
                       FontFamily="Snap ITC" FontSize="100" TextAlignment="Center"
                       Foreground="Red" 
                       Canvas.Left="0" Canvas.Top="170" Width="1000"/>
            <ContentControl x:Name="human" Content="ContentControl" Template="{DynamicResource humanTemplate}" MouseDown="human_MouseDown"/>
        </Canvas>
        <StackPanel  Grid.Row="1" Grid.Column="2" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
            <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="Avoid These" VerticalAlignment="Top"
                       Foreground="PowderBlue" FontFamily="Arial" FontSize="18" RenderTransformOrigin="0.5,0.5" FontWeight="Bold"
                       Margin="0,0,0,5">
                <TextBlock.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="1.2" ScaleY="1.5"/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </TextBlock.RenderTransform>
            </TextBlock>
            <StackPanel Orientation="Horizontal">
                <ContentControl x:Name="alienContentControl" Content="ContentControl" Template="{DynamicResource AlienTemplate}"/>
                <ContentControl Content="ContentControl" Template="{DynamicResource hornAlienTemplate}"/>
            </StackPanel>
        </StackPanel>
    </Grid>
</Window>
